package cn.edu.scau.cmi.lijiongtao.safeComposite;

import java.util.ArrayList;

public class Composite extends WorldOrganization {
	private ArrayList<WorldOrganization> countryList;
	private String saying = "";
	public Composite() {
		countryList = new ArrayList<WorldOrganization>();
	}
	
	public void add(WorldOrganization country) {
		if(country != null) {
			countryList.add(country);
		}
	}
	
	public void remove(WorldOrganization country) {
		if(country != null) {
			countryList.remove(country);
		}
	}
	
	public String say() {
		int length = countryList.size();
		for(int i = 0; i < length; i++) {
			WorldOrganization temp = countryList.get(i);
			saying += temp.say() + "\n";
		}
		return saying;
	}
	
	public int getSize() {
		return countryList.size();
	}
}
